function Vue(options) {
    this.$options = options;
    this.$data = options.data;
    observe(this.$data);
    proxy(this.$data, this);
}

Vue.prototype.$mount = function(sel) {
    this._update = function() {
        // 初始化
        if (!this._isMounted) {
            const parent = document.querySelector(sel);
            const vnode = this.$options.render.call(this, this.createElement);
            this.dispatch(parent, vnode);
            this._isMounted = true;
            if (this.$options.mounted) {
                this.$options.mounted.call(this);
            }
        } else {
            this.dispatch()
        }
    }
}

Vue.prototype.createElement = function(tag, props, children) {
    return {tag, props, children}
}

Vue.prototype.dispatch = function(n1, n2) {
    if (n1.nodeType) {
        const child = this.createElm(n2);
        parent.appendChild(child);
    } else {
        // diff算法进行更新
        
    }
}

Vue.prototype.createElm = function(vnode) {
    const {tag, props, children} = vnode;
    const dom = document.createElement(tag);
    if (typeof children === "string") {
        dom.textContent = children;
    } else {
    }
    vnode.$el = dom;
    return dom
}

function observe(data) {}